<?php

/**
 *  小鸟接码
 */
class BirdCode{
    private $Html = '';
    public $PhoneList = '';
    public $Mssage = '';

    function __construct(){
        $this->getPhone();
    }

    // 获取号码
    function getPhone(){
        $this->Html = file_get_html('http://www.xnsms.com/');
        foreach ($this->Html->find('p.number') as $v)
            $this->PhoneList[] = 'c_'.$v->plaintext;
    }

    // 获取最近短信
    function getMessage($phone){
        $this->Html =  file_get_html('http://www.xnsms.com/test/getPhoneData?phone='.$phone);
        $number = 1;
        foreach ($this->Html->find('tr') as $v){
            if ($number != 1){
                $content['tel'] = $phone;
                $content['msg'] = $v->find('td',2)->plaintext;
                $content['time'] = $v->find('td',3)->plaintext;
                $this->Mssage[] = $content;
            }
            $number = 2;
        }
    }
}